#pragma once


class AttrTreeNodeHead : public ui::TreeNode
{
public:
	virtual void OnClickItem() override;
	virtual void SetExpand(bool bExpand) override;
};

class AttrTreeNodeGrid : public ui::TreeNode
{
public:
	bool InitNodeGrid(Control* control);
	bool InsertAttr(const ui::ContrlAttrVistorItem& attr);
	bool OnGridTextChanged(ui::EventArgs *args);
public:
	ui::Grid *m_pGrid;
	ui::Control *m_pControl{ nullptr };
	ui::ContrlAttrVistor m_Visitor;
};

class Canvas;
class AttrTree : public ui::TreeView
{
public:
	AttrTree();
	virtual ~AttrTree();
	void InitTree(Canvas *canvas);
	
	bool SelectControl(Control *control);

	/*ui::TreeNode *FindNodeByDataId(std::string id);
	ui::TreeNode *FindNodeByDataId(ui::TreeNode *parentNode, std::string id);*/
private:
	Canvas *m_pCanvas;

	Control *m_pControl{ nullptr };
};

